package tw.com.msig.b2c.car.setting.service.impl;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import tw.com.msig.b2c.car.setting.dao.AnnounceDao;
import tw.com.msig.b2c.car.setting.service.AnnounceService;
import tw.com.msig.b2c.car.setting.vo.AnnounceVo;

public class AnnounceSeriverImpl implements AnnounceService {

	private Logger log = LoggerFactory.getLogger(this.getClass());
	private AnnounceDao annDao;

	public AnnounceDao getAnnDao() {
		return annDao;
	}

	public void setAnnDao(AnnounceDao annDao) {
		this.annDao = annDao;
	}

	@Override
	public List<AnnounceVo> getAll() {

		return annDao.findAll();
	}

	@Override
	public AnnounceVo getById(long id) {

		return annDao.findById(id);
	}

	@Override
	public void insert(AnnounceVo anoVO) {
		
		annDao.insert(anoVO);
		
	}

	@Override
	public void update(AnnounceVo anoVO) {
		
		AnnounceVo anoVoS = annDao.findById(anoVO.getId());
		anoVoS.setTitle(anoVO.getTitle());
		anoVoS.setContent((anoVO.getContent()));
		anoVoS.setModifier(anoVO.getModifier());
		anoVoS.setModifyTime(anoVO.getModifyTime());
		
		annDao.update(anoVoS);
		
	}

	@Override
	public void delete(AnnounceVo anoVo) {
		annDao.delete(anoVo);
		
	}

}
